package hashcode;

import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-07-03
 * Time: 9:44
 */
class A{
    public String id;

    public A(String id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        A a = (A) o;
        return Objects.equals(id, a.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
public class Test {
    public static void main(String[] args) {
        A a =new A("123");
        A a1 = new A("123");
        System.out.println(a.hashCode());
        System.out.println(a1.hashCode());
    }
}
